package cn.myjerry.others.guava;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

/**
 * HashMap 键唯一，值可重复
 * BiMap:双向Map -----> 键和值都唯一
 * @author Jerry
 */
public class Demo07 {
	public static void main(String[] args) {
		BiMap<String, String> bimap = HashBiMap.create();
		bimap.put("root", "root123");
		bimap.put("user", "user123");
		
		// 通过密码找账号
		String usr = bimap.inverse().get("root123");
		System.out.println(usr);
		System.out.println(bimap.inverse().inverse() == bimap);
	}
}
